package atom.core0.global;

import atom.core0.util.security.JDES;

public class GlobalDes {
	private static JDES des = new JDES();

	public static JDES getDes() {
		return des;
	}

	public static void setDes(JDES des) {
		GlobalDes.des = des;
	}
	public static void setDeskey(String deskey) {
		des.SetKey(deskey.getBytes());
	}
	public static String decryptDB(String password)
	{
		byte[] secpassword = "".getBytes();//Base64.decodeBase64(password);
		JDES des = new JDES();
		//此密钥放到数据库中，读取到内存中，这样的话，破解代码也不知道密钥
		des.SetKey("antlym98".getBytes());
		String newpassword = "";
		try {

			byte[] newbyte = des.doECBDecrypt(secpassword, secpassword.length);
			newpassword = new String(newbyte);
		} catch (Exception e) {
			e.printStackTrace();
			newpassword="";
		}		
		return newpassword;
	}	
}
